// =======================================================================
// 
//       Filename:  elementstack.hpp
// 
//    Description:  
// 
//        Version:  1.0
//        Created:  24.05.2010 21:16:33
//       Revision:  none
//       Compiler:  g++
// 
//         Author:  Dominik 'domachine' Burgdörfer (-), dominik.burgdoerfer@googlemail.com
//        Company:  -
// 
// =======================================================================


#ifndef  ELEMENTSTACK_INC
#define  ELEMENTSTACK_INC
#include "elements/element.hpp"
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <fstream>

namespace webplodder {
    template <class T>
    class BasicElementStack : public std::vector<T>,
                              public elements::Element
    {
    public:
        BasicElementStack()
            : Element(Element::STACK), 
            m_lineOffset(0), m_processed(false)
        {

        }

        BasicElementStack(const boost::filesystem::path& sourcePath)
            : Element(Element::STACK), 
            m_sourcePath(sourcePath), m_lineOffset(0), 
            m_processed(false)
        {

        }

        boost::filesystem::path sourcePath() const
        {
            return m_sourcePath;
        }

        void setLineOffset(int offset) {
            m_lineOffset = offset;
        }

        int lineOffset() const
        {
            return m_lineOffset;
        }
        
        void setProcessed(bool state = true) {
            m_processed = true;
        }

        bool processed() const
        {
            return m_processed;
        }

    private:
        boost::filesystem::path m_sourcePath;
        int m_lineOffset;
        bool m_processed;
    };
    
    typedef boost::shared_ptr<elements::Element> ElementPtr;
    typedef BasicElementStack<ElementPtr> ElementStack;
}
#endif   // ----- #ifndef ELEMENTSTACK_INC  -----
